Expand description

🦀 ErasedSet

You may be looking for:


This crate provides a new collection: The ErasedSet.

It can store any type T: Any.

Example

use erased_set::ErasedSet;

let mut set = ErasedSet::new();
set.insert(ClickEvent(128, 256));
set.insert(KeyDownEvent('z'));

assert_eq!(set.get::<ClickEvent>(), Some(&ClickEvent(128, 256)));

assert_eq!(set.insert(KeyDownEvent('e')), Some(KeyDownEvent('z')));

set.remove::<ClickEvent>();

assert_eq!(set.len(), 1);

Features

namedefault ?description
sendyesEnables ErasedSendSet
syncyesEnables ErasedSyncSet

no_std support

This crate is no_std compatible, however it still requires alloc.

Structs

Like ErasedSet but with a Send bound.

A set of erased types.

Like ErasedSet but with a Send + Sync bound.